 /* Copyright 2018 JDCLOUD.COM

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http:#www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.





Contact: 

NOTE: This class is auto generated by the jdcloud code generator program.
*/


#import <Foundation/Foundation.h>
#import <JDCloudOCSDKJcq/JcqModel.h>

@implementation Queue
-(id) initWithQueueId:(NSNumber*) queueId
      queuePermission:(NSString*)queuePermission { 
     self.queueId = queueId;               
     self.queuePermission = queuePermission;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self queueId])
    {
        [result setValue:[self queueId] forKey:@"queueId"];
    }
    if([self queuePermission])
    {
        [result setValue:[self queuePermission] forKey:@"queuePermission"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.queueId = [dictionary objectForKey:@"queueId"];
    self.queuePermission = [dictionary objectForKey:@"queuePermission"];
    return self;
}
 @end
@implementation Tag
-(id) initWithKey:(NSString*) key
      value:(NSString*)value { 
     self.key = key;               
     self.value = value;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self key])
    {
        [result setValue:[self key] forKey:@"key"];
    }
    if([self value])
    {
        [result setValue:[self value] forKey:@"value"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.key = [dictionary objectForKey:@"key"];
    self.value = [dictionary objectForKey:@"value"];
    return self;
}
 @end
@implementation TopicConfig
-(id) initWithMaxMessageSizeKB:(NSNumber*) maxMessageSizeKB
      threshold:(NSNumber*)threshold
      topicPermission:(NSString*)topicPermission
      topicType:(NSString*)topicType { 
     self.maxMessageSizeKB = maxMessageSizeKB;               
     self.threshold = threshold;               
     self.topicPermission = topicPermission;               
     self.topicType = topicType;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self maxMessageSizeKB])
    {
        [result setValue:[self maxMessageSizeKB] forKey:@"maxMessageSizeKB"];
    }
    if([self threshold])
    {
        [result setValue:[self threshold] forKey:@"threshold"];
    }
    if([self topicPermission])
    {
        [result setValue:[self topicPermission] forKey:@"topicPermission"];
    }
    if([self topicType])
    {
        [result setValue:[self topicType] forKey:@"topicType"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.maxMessageSizeKB = [dictionary objectForKey:@"maxMessageSizeKB"];
    self.threshold = [dictionary objectForKey:@"threshold"];
    self.topicPermission = [dictionary objectForKey:@"topicPermission"];
    self.topicType = [dictionary objectForKey:@"topicType"];
    return self;
}
 @end
@implementation Subscription
-(id) initWithConsumerGroupId:(NSString*) consumerGroupId
      endPoint:(NSString*)endPoint
      messageInvisibleTimeInSeconds:(NSNumber*)messageInvisibleTimeInSeconds
      subscriptionType:(NSString*)subscriptionType
      tags:(NSArray<NSString*>*)tags
      dlqEnable:(NSNumber*)dlqEnable
      maxRetryTimes:(NSNumber*)maxRetryTimes
      createTime:(NSString*)createTime
      lastUpdateTime:(NSString*)lastUpdateTime
      consumerNumbers:(NSNumber*)consumerNumbers { 
     self.consumerGroupId = consumerGroupId;               
     self.endPoint = endPoint;               
     self.messageInvisibleTimeInSeconds = messageInvisibleTimeInSeconds;               
     self.subscriptionType = subscriptionType;               
     self.tags = tags;               
     self.dlqEnable = dlqEnable;               
     self.maxRetryTimes = maxRetryTimes;               
     self.createTime = createTime;               
     self.lastUpdateTime = lastUpdateTime;               
     self.consumerNumbers = consumerNumbers;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self consumerGroupId])
    {
        [result setValue:[self consumerGroupId] forKey:@"consumerGroupId"];
    }
    if([self endPoint])
    {
        [result setValue:[self endPoint] forKey:@"endPoint"];
    }
    if([self messageInvisibleTimeInSeconds])
    {
        [result setValue:[self messageInvisibleTimeInSeconds] forKey:@"messageInvisibleTimeInSeconds"];
    }
    if([self subscriptionType])
    {
        [result setValue:[self subscriptionType] forKey:@"subscriptionType"];
    }
    if([self tags])
    {
        [result setValue:[self tags] forKey:@"tags"];
    }
    if([self dlqEnable])
    {
        [result setValue:[self dlqEnable] forKey:@"dlqEnable"];
    }
    if([self maxRetryTimes])
    {
        [result setValue:[self maxRetryTimes] forKey:@"maxRetryTimes"];
    }
    if([self createTime])
    {
        [result setValue:[self createTime] forKey:@"createTime"];
    }
    if([self lastUpdateTime])
    {
        [result setValue:[self lastUpdateTime] forKey:@"lastUpdateTime"];
    }
    if([self consumerNumbers])
    {
        [result setValue:[self consumerNumbers] forKey:@"consumerNumbers"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.consumerGroupId = [dictionary objectForKey:@"consumerGroupId"];
    self.endPoint = [dictionary objectForKey:@"endPoint"];
    self.messageInvisibleTimeInSeconds = [dictionary objectForKey:@"messageInvisibleTimeInSeconds"];
    self.subscriptionType = [dictionary objectForKey:@"subscriptionType"];
    self.tags = [dictionary objectForKey:@"tags"];
    self.dlqEnable = [dictionary objectForKey:@"dlqEnable"];
    self.maxRetryTimes = [dictionary objectForKey:@"maxRetryTimes"];
    self.createTime = [dictionary objectForKey:@"createTime"];
    self.lastUpdateTime = [dictionary objectForKey:@"lastUpdateTime"];
    self.consumerNumbers = [dictionary objectForKey:@"consumerNumbers"];
    return self;
}
 @end
@implementation ConsumerInfoDetail
-(id) initWithConsumerIp:(NSString*) consumerIp
      timeStamp:(NSNumber*)timeStamp
      costTime:(NSNumber*)costTime
      consumeTimes:(NSNumber*)consumeTimes
      consumerStatus:(NSString*)consumerStatus { 
     self.consumerIp = consumerIp;               
     self.timeStamp = timeStamp;               
     self.costTime = costTime;               
     self.consumeTimes = consumeTimes;               
     self.consumerStatus = consumerStatus;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self consumerIp])
    {
        [result setValue:[self consumerIp] forKey:@"consumerIp"];
    }
    if([self timeStamp])
    {
        [result setValue:[self timeStamp] forKey:@"timeStamp"];
    }
    if([self costTime])
    {
        [result setValue:[self costTime] forKey:@"costTime"];
    }
    if([self consumeTimes])
    {
        [result setValue:[self consumeTimes] forKey:@"consumeTimes"];
    }
    if([self consumerStatus])
    {
        [result setValue:[self consumerStatus] forKey:@"consumerStatus"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.consumerIp = [dictionary objectForKey:@"consumerIp"];
    self.timeStamp = [dictionary objectForKey:@"timeStamp"];
    self.costTime = [dictionary objectForKey:@"costTime"];
    self.consumeTimes = [dictionary objectForKey:@"consumeTimes"];
    self.consumerStatus = [dictionary objectForKey:@"consumerStatus"];
    return self;
}
 @end
@implementation ProduceInfo
-(id) initWithAddress:(NSString*) address
      timeStamp:(NSNumber*)timeStamp
      costTime:(NSNumber*)costTime
      messageSendStatus:(NSString*)messageSendStatus
      delayTime:(NSNumber*)delayTime { 
     self.address = address;               
     self.timeStamp = timeStamp;               
     self.costTime = costTime;               
     self.messageSendStatus = messageSendStatus;               
     self.delayTime = delayTime;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self address])
    {
        [result setValue:[self address] forKey:@"address"];
    }
    if([self timeStamp])
    {
        [result setValue:[self timeStamp] forKey:@"timeStamp"];
    }
    if([self costTime])
    {
        [result setValue:[self costTime] forKey:@"costTime"];
    }
    if([self messageSendStatus])
    {
        [result setValue:[self messageSendStatus] forKey:@"messageSendStatus"];
    }
    if([self delayTime])
    {
        [result setValue:[self delayTime] forKey:@"delayTime"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.address = [dictionary objectForKey:@"address"];
    self.timeStamp = [dictionary objectForKey:@"timeStamp"];
    self.costTime = [dictionary objectForKey:@"costTime"];
    self.messageSendStatus = [dictionary objectForKey:@"messageSendStatus"];
    self.delayTime = [dictionary objectForKey:@"delayTime"];
    return self;
}
 @end
@implementation DeadLetter
-(id) initWithMessageId:(NSString*) messageId
      expireTime:(NSString*)expireTime { 
     self.messageId = messageId;               
     self.expireTime = expireTime;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self messageId])
    {
        [result setValue:[self messageId] forKey:@"messageId"];
    }
    if([self expireTime])
    {
        [result setValue:[self expireTime] forKey:@"expireTime"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.messageId = [dictionary objectForKey:@"messageId"];
    self.expireTime = [dictionary objectForKey:@"expireTime"];
    return self;
}
 @end
@implementation Permission
-(id) initWithUserId:(NSString*) userId
      permissionValue:(NSString*)permissionValue { 
     self.userId = userId;               
     self.permissionValue = permissionValue;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self userId])
    {
        [result setValue:[self userId] forKey:@"userId"];
    }
    if([self permissionValue])
    {
        [result setValue:[self permissionValue] forKey:@"permission"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.userId = [dictionary objectForKey:@"userId"];
    self.permissionValue = [dictionary objectForKey:@"permission"];
    return self;
}
 @end
@implementation DeadLetterNumber
-(id) initWithTopicId:(NSString*) topicId
      topicName:(NSString*)topicName
      consumerGroupId:(NSString*)consumerGroupId
      deadLetterNumberValue:(NSNumber*)deadLetterNumberValue { 
     self.topicId = topicId;               
     self.topicName = topicName;               
     self.consumerGroupId = consumerGroupId;               
     self.deadLetterNumberValue = deadLetterNumberValue;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self topicId])
    {
        [result setValue:[self topicId] forKey:@"topicId"];
    }
    if([self topicName])
    {
        [result setValue:[self topicName] forKey:@"topicName"];
    }
    if([self consumerGroupId])
    {
        [result setValue:[self consumerGroupId] forKey:@"consumerGroupId"];
    }
    if([self deadLetterNumberValue])
    {
        [result setValue:[self deadLetterNumberValue] forKey:@"deadLetterNumber"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.topicId = [dictionary objectForKey:@"topicId"];
    self.topicName = [dictionary objectForKey:@"topicName"];
    self.consumerGroupId = [dictionary objectForKey:@"consumerGroupId"];
    self.deadLetterNumberValue = [dictionary objectForKey:@"deadLetterNumber"];
    return self;
}
 @end
@implementation Message
-(id) initWithMessageId:(NSString*) messageId
      body:(NSString*)body
      tags:(NSString*)tags
      properties:(NSString*)properties
      storeTime:(NSNumber*)storeTime { 
     self.messageId = messageId;               
     self.body = body;               
     self.tags = tags;               
     self.properties = properties;               
     self.storeTime = storeTime;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self messageId])
    {
        [result setValue:[self messageId] forKey:@"messageId"];
    }
    if([self body])
    {
        [result setValue:[self body] forKey:@"body"];
    }
    if([self tags])
    {
        [result setValue:[self tags] forKey:@"tags"];
    }
    if([self properties])
    {
        [result setValue:[self properties] forKey:@"properties"];
    }
    if([self storeTime])
    {
        [result setValue:[self storeTime] forKey:@"storeTime"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.messageId = [dictionary objectForKey:@"messageId"];
    self.body = [dictionary objectForKey:@"body"];
    self.tags = [dictionary objectForKey:@"tags"];
    self.properties = [dictionary objectForKey:@"properties"];
    self.storeTime = [dictionary objectForKey:@"storeTime"];
    return self;
}
 @end
@implementation AccessPoint
-(id) initWithSdkAddress:(NSString*) sdkAddress
      httpAddress:(NSString*)httpAddress { 
     self.sdkAddress = sdkAddress;               
     self.httpAddress = httpAddress;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self sdkAddress])
    {
        [result setValue:[self sdkAddress] forKey:@"sdkAddress"];
    }
    if([self httpAddress])
    {
        [result setValue:[self httpAddress] forKey:@"httpAddress"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.sdkAddress = [dictionary objectForKey:@"sdkAddress"];
    self.httpAddress = [dictionary objectForKey:@"httpAddress"];
    return self;
}
 @end
@implementation TopicRouteInfo
-(id) initWithBrokerAddress:(NSString*) brokerAddress
      queues:(NSArray<Queue*>*)queues { 
     self.brokerAddress = brokerAddress;               
     self.queues = queues;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self brokerAddress])
    {
        [result setValue:[self brokerAddress] forKey:@"brokerAddress"];
    }
    if([self queues])
    {
        NSMutableArray<NSDictionary*>* arrayDic  = [[NSMutableArray alloc] init];
        for (int i =0 ; i< [[self queues] count]; i++) {
            Queue* item = [[self queues] objectAtIndex:i];
            [arrayDic addObject:[item dictionary]];
        }
        [result setValue:arrayDic forKey:@"queues"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.brokerAddress = [dictionary objectForKey:@"brokerAddress"];
    NSArray* queuesArray = [dictionary objectForKey:@"queues"];
    if(queuesArray&&![queuesArray isKindOfClass:[NSNull class]])
    {
        NSMutableArray* propertyArray = [[NSMutableArray alloc]init];
        for(int i = 0 ; i< [queuesArray count];i++)
        {
            Queue* item = [[Queue alloc]initWithDic:[queuesArray objectAtIndex:i]];
            if(item)
            {
                [propertyArray addObject:item];
            }
        }
        self.queues = propertyArray;
    }
    return self;
}
 @end
@implementation Topic
-(id) initWithTopicId:(NSString*) topicId
      topicName:(NSString*)topicName
      descriptionValue:(NSString*)descriptionValue
      createTime:(NSString*)createTime
      lastUpdateTime:(NSString*)lastUpdateTime
      topicStatus:(NSString*)topicStatus
      subscriptionCount:(NSNumber*)subscriptionCount
      messageLifeTimeInHours:(NSNumber*)messageLifeTimeInHours
      topicConfig:(TopicConfig*)topicConfig
      own:(NSNumber*)own
      authorizedPermission:(NSString*)authorizedPermission
      tags:(NSArray<Tag*>*)tags { 
     self.topicId = topicId;               
     self.topicName = topicName;               
     self.descriptionValue = descriptionValue;               
     self.createTime = createTime;               
     self.lastUpdateTime = lastUpdateTime;               
     self.topicStatus = topicStatus;               
     self.subscriptionCount = subscriptionCount;               
     self.messageLifeTimeInHours = messageLifeTimeInHours;               
     self.topicConfig = topicConfig;               
     self.own = own;               
     self.authorizedPermission = authorizedPermission;               
     self.tags = tags;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self topicId])
    {
        [result setValue:[self topicId] forKey:@"topicId"];
    }
    if([self topicName])
    {
        [result setValue:[self topicName] forKey:@"topicName"];
    }
    if([self descriptionValue])
    {
        [result setValue:[self descriptionValue] forKey:@"description"];
    }
    if([self createTime])
    {
        [result setValue:[self createTime] forKey:@"createTime"];
    }
    if([self lastUpdateTime])
    {
        [result setValue:[self lastUpdateTime] forKey:@"lastUpdateTime"];
    }
    if([self topicStatus])
    {
        [result setValue:[self topicStatus] forKey:@"topicStatus"];
    }
    if([self subscriptionCount])
    {
        [result setValue:[self subscriptionCount] forKey:@"subscriptionCount"];
    }
    if([self messageLifeTimeInHours])
    {
        [result setValue:[self messageLifeTimeInHours] forKey:@"messageLifeTimeInHours"];
    }
    if([self topicConfig])
    {
        [result setValue:[[self topicConfig] dictionary]forKey:@"topicConfig"];
    }
    if([self own])
    {
        [result setValue:[self own] forKey:@"own"];
    }
    if([self authorizedPermission])
    {
        [result setValue:[self authorizedPermission] forKey:@"authorizedPermission"];
    }
    if([self tags])
    {
        NSMutableArray<NSDictionary*>* arrayDic  = [[NSMutableArray alloc] init];
        for (int i =0 ; i< [[self tags] count]; i++) {
            Tag* item = [[self tags] objectAtIndex:i];
            [arrayDic addObject:[item dictionary]];
        }
        [result setValue:arrayDic forKey:@"tags"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.topicId = [dictionary objectForKey:@"topicId"];
    self.topicName = [dictionary objectForKey:@"topicName"];
    self.descriptionValue = [dictionary objectForKey:@"description"];
    self.createTime = [dictionary objectForKey:@"createTime"];
    self.lastUpdateTime = [dictionary objectForKey:@"lastUpdateTime"];
    self.topicStatus = [dictionary objectForKey:@"topicStatus"];
    self.subscriptionCount = [dictionary objectForKey:@"subscriptionCount"];
    self.messageLifeTimeInHours = [dictionary objectForKey:@"messageLifeTimeInHours"];
    self.topicConfig = [[TopicConfig alloc]initWithDic:[dictionary objectForKey:@"topicConfig"]];
    self.own = [dictionary objectForKey:@"own"];
    self.authorizedPermission = [dictionary objectForKey:@"authorizedPermission"];
    NSArray* tagsArray = [dictionary objectForKey:@"tags"];
    if(tagsArray&&![tagsArray isKindOfClass:[NSNull class]])
    {
        NSMutableArray* propertyArray = [[NSMutableArray alloc]init];
        for(int i = 0 ; i< [tagsArray count];i++)
        {
            Tag* item = [[Tag alloc]initWithDic:[tagsArray objectAtIndex:i]];
            if(item)
            {
                [propertyArray addObject:item];
            }
        }
        self.tags = propertyArray;
    }
    return self;
}
 @end
@implementation ConsumeInfo
-(id) initWithConsumerGroupId:(NSString*) consumerGroupId
      messageConsumeStatus:(NSString*)messageConsumeStatus
      successTimes:(NSNumber*)successTimes
      failedTimes:(NSNumber*)failedTimes
      consumerInfoDetailList:(NSArray<ConsumerInfoDetail*>*)consumerInfoDetailList { 
     self.consumerGroupId = consumerGroupId;               
     self.messageConsumeStatus = messageConsumeStatus;               
     self.successTimes = successTimes;               
     self.failedTimes = failedTimes;               
     self.consumerInfoDetailList = consumerInfoDetailList;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self consumerGroupId])
    {
        [result setValue:[self consumerGroupId] forKey:@"consumerGroupId"];
    }
    if([self messageConsumeStatus])
    {
        [result setValue:[self messageConsumeStatus] forKey:@"messageConsumeStatus"];
    }
    if([self successTimes])
    {
        [result setValue:[self successTimes] forKey:@"successTimes"];
    }
    if([self failedTimes])
    {
        [result setValue:[self failedTimes] forKey:@"failedTimes"];
    }
    if([self consumerInfoDetailList])
    {
        NSMutableArray<NSDictionary*>* arrayDic  = [[NSMutableArray alloc] init];
        for (int i =0 ; i< [[self consumerInfoDetailList] count]; i++) {
            ConsumerInfoDetail* item = [[self consumerInfoDetailList] objectAtIndex:i];
            [arrayDic addObject:[item dictionary]];
        }
        [result setValue:arrayDic forKey:@"consumerInfoDetailList"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.consumerGroupId = [dictionary objectForKey:@"consumerGroupId"];
    self.messageConsumeStatus = [dictionary objectForKey:@"messageConsumeStatus"];
    self.successTimes = [dictionary objectForKey:@"successTimes"];
    self.failedTimes = [dictionary objectForKey:@"failedTimes"];
    NSArray* consumerInfoDetailListArray = [dictionary objectForKey:@"consumerInfoDetailList"];
    if(consumerInfoDetailListArray&&![consumerInfoDetailListArray isKindOfClass:[NSNull class]])
    {
        NSMutableArray* propertyArray = [[NSMutableArray alloc]init];
        for(int i = 0 ; i< [consumerInfoDetailListArray count];i++)
        {
            ConsumerInfoDetail* item = [[ConsumerInfoDetail alloc]initWithDic:[consumerInfoDetailListArray objectAtIndex:i]];
            if(item)
            {
                [propertyArray addObject:item];
            }
        }
        self.consumerInfoDetailList = propertyArray;
    }
    return self;
}
 @end
@implementation MessageTraceInfo
-(id) initWithProduceInfo:(ProduceInfo*) produceInfo
      consumeInfoList:(NSArray<ConsumeInfo*>*)consumeInfoList { 
     self.produceInfo = produceInfo;               
     self.consumeInfoList = consumeInfoList;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self produceInfo])
    {
        [result setValue:[[self produceInfo] dictionary]forKey:@"produceInfo"];
    }
    if([self consumeInfoList])
    {
        NSMutableArray<NSDictionary*>* arrayDic  = [[NSMutableArray alloc] init];
        for (int i =0 ; i< [[self consumeInfoList] count]; i++) {
            ConsumeInfo* item = [[self consumeInfoList] objectAtIndex:i];
            [arrayDic addObject:[item dictionary]];
        }
        [result setValue:arrayDic forKey:@"consumeInfoList"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.produceInfo = [[ProduceInfo alloc]initWithDic:[dictionary objectForKey:@"produceInfo"]];
    NSArray* consumeInfoListArray = [dictionary objectForKey:@"consumeInfoList"];
    if(consumeInfoListArray&&![consumeInfoListArray isKindOfClass:[NSNull class]])
    {
        NSMutableArray* propertyArray = [[NSMutableArray alloc]init];
        for(int i = 0 ; i< [consumeInfoListArray count];i++)
        {
            ConsumeInfo* item = [[ConsumeInfo alloc]initWithDic:[consumeInfoListArray objectAtIndex:i]];
            if(item)
            {
                [propertyArray addObject:item];
            }
        }
        self.consumeInfoList = propertyArray;
    }
    return self;
}
 @end
@implementation TopicWrapper
-(id) initWithTopic:(Topic*) topic
      routeInfos:(NSArray<TopicRouteInfo*>*)routeInfos { 
     self.topic = topic;               
     self.routeInfos = routeInfos;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self topic])
    {
        [result setValue:[[self topic] dictionary]forKey:@"topic"];
    }
    if([self routeInfos])
    {
        NSMutableArray<NSDictionary*>* arrayDic  = [[NSMutableArray alloc] init];
        for (int i =0 ; i< [[self routeInfos] count]; i++) {
            TopicRouteInfo* item = [[self routeInfos] objectAtIndex:i];
            [arrayDic addObject:[item dictionary]];
        }
        [result setValue:arrayDic forKey:@"routeInfos"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.topic = [[Topic alloc]initWithDic:[dictionary objectForKey:@"topic"]];
    NSArray* routeInfosArray = [dictionary objectForKey:@"routeInfos"];
    if(routeInfosArray&&![routeInfosArray isKindOfClass:[NSNull class]])
    {
        NSMutableArray* propertyArray = [[NSMutableArray alloc]init];
        for(int i = 0 ; i< [routeInfosArray count];i++)
        {
            TopicRouteInfo* item = [[TopicRouteInfo alloc]initWithDic:[routeInfosArray objectAtIndex:i]];
            if(item)
            {
                [propertyArray addObject:item];
            }
        }
        self.routeInfos = propertyArray;
    }
    return self;
}
 @end
 
 


